package cn.tedu.egmybatis1.mapper;

import cn.tedu.egmybatis1.pojo.entity.Product;
import cn.tedu.egmybatis1.pojo.vo.SelectProductVO1;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 增删改都是返回int类型
 * 查询单条数据返回一个实体类，多条数据返回一个List<实体类>集合
 */
@Mapper
public interface ProductMapper {
    //@Insert("insert into product(title,price,stock) values(#{title},#{price},#{stock})")
    int insertProduct(Product product);

    //@Select("select id,title,price,stock from product where id=#{id}")
    SelectProductVO1 selectSingleProduct(int id);

    //@Delete("delete from product where id=#{id}")
    int deleteById(int id);

//    @Select("select id,title,price,stock from product")
//    List<Product> selectManyProduct();

}
